<!--
 * @Description:
 * @Author: lucl
 * @Date: 2021-06-25 09:03:47
 * @LastEditors: Ronda
 * @LastEditTime: 2021-07-03 19:53:46
-->
<template>
  <div>
    <!-- 日志表格 -->
    <div>
      <template>
        <el-table :data="tableData" style="width: 100%">
          <el-table-column type="index" label="序号" width="180" />
          <el-table-column prop="realname" label="访问人真是姓名" width="180" />
          <el-table-column prop="method" label="访问方式" />
          <el-table-column prop="content" label="访问路径" />
          <el-table-column prop="logTime" label="访问时间">
            <template slot-scope="scope">
              <div>{{ Moment(scope.row.logTime).format('YYYY MM DD, hh:mm:ss') }}</div>
              <!-- <div>{{ Moment(scope.row.transferTime).format("YYYY-MM-DD HH:mm:ss") }}</div> -->

            </template>
          </el-table-column>
        </el-table>
      </template>
    </div>
    <!-- 分页 -->
    <div>
      <div class="block">
        <el-pagination :current-page="currentPage" :page-sizes="[10, 20, 30, 40]" :page-size="params.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total" style="float:right;" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
      </div>
    </div>
  </div>
</template>

<script>
import Moment from 'moment'
import { pageQuery } from '@/api/log'
export default {
  data() {
    return {
      total: 1,
      currentPage: 1,
      tableData: [],
      params: {
        page: 1,
        pageSize: 10
      }
    }
  },
  computed: {},
  created() {
    this.shuaxin()
  },
  mounted() { },
  methods: {
    Moment,
    handleSizeChange(val) {
      this.params.pageSize = val
      // console.log(`每页 ${val} 条`);
      this.shuaxin()
    },
    handleCurrentChange(val) {
      this.params.page = val
      // console.log(`当前页: ${val}`);
      this.shuaxin()
    },
    async shuaxin() {
      const res = await pageQuery(this.params)
      // console.log(res)
      this.total = res.data.total
      this.tableData = res.data.list
    }
  }
}
</script>
<style scoped>
</style>
